import request from '../utils/request';

/**
 * 查询角色列表
 * @param query
 * @returns {AxiosPromise}
 */
export const selectList = query => {
    return request({
        url: 'rest/sysUser/select',
        method: 'POST',
        data: query
    });
};

export const selectAll = query => {
    return request({
        url: 'rest/sysUser/selectAll',
        method: 'POST',
        data: query
    });
};

/**
 * 查看角色
 * @param query
 * @returns {AxiosPromise}
 */
export const selectSysUser = query => {
    return request({
        url: 'rest/sysUser/' + query,
        method: 'POST',
    });
};

/**
 * 新增角色
 * @param query
 * @returns {AxiosPromise}
 */
export const addSysUser = query => {
    return request({
        url: 'rest/sysUser/insert',
        method: 'POST',
        data: query
    });
};

/**
 * 编辑角色
 * @param query
 * @returns {AxiosPromise}
 */
export const updateSysUser = query => {
    return request({
        url: 'rest/sysUser/update',
        method: 'POST',
        data: query
    });
};

/**
 * 编辑角色
 * @param query
 * @returns {AxiosPromise}
 */
export const updatePwd = query => {
    return request({
        url: 'rest/sysUser/updatePwd',
        method: 'POST',
        data: query
    });
};

/**
 * 删除角色
 * @param query
 * @returns {AxiosPromise}
 */
export const delSysUser = query => {
    return request({
        url: 'rest/sysUser/update',
        method: 'POST',
        data: query
    });
};

/**
 * 查看角色
 * @param query
 * @returns {AxiosPromise}
 */
export const sysRoleList = query => {
    return request({
        url: 'rest/sysRole/select',
        method: 'POST',
        data: query
    });
};

/**
 * 查看用户角色
 * @param query
 * @returns {AxiosPromise}
 */
export const getUserRole = query => {
    return request({
        url: 'rest/sysUserRole/' + query,
        method: 'POST',
        data: query
    });
};

/**
 *  启用禁用
 * @param query
 * @returns {AxiosPromise}
 */
export const enableAndDisable = query => {
    return request({
        url: 'rest/sysUser/enableAndDisable',
        method: 'POST',
        data: query
    });
};